var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/hmblog',{ useNewUrlParser: true });

var themeSchema = new mongoose.Schema({
    title:{
        type:String,
        required:true
    },
    content:{
        type:String,
        required:true
    },
    publishTime:{
        type:Date,
        default:Date.now
    },
    modifyTime:{
        type:Date,
        default:Date.now
    },
    authorId:{
        type:String,
        required:true
    },
    good:{
        type:Number,
        enum:[0,1],
        default:0
    },
    top:{
        type:Number,
        enum:[0,1],
        default:0
    }


})

module.exports = mongoose.model('Theme',themeSchema)